package com.home766.entity;

import com.fasterxml.jackson.annotation.JsonProperty;
import net.biz.entity.BaseEntity;
import net.biz.entity.Tag;

import javax.persistence.*;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 方案-entity
 */
@Entity
@Table(name="766_scheme")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "766_scheme_sequence")
public class Scheme extends BaseEntity {

	private static final long serialVersionUID = 795525249676298804L;
	
	/**方案编号*/
	private String sn ;
	/**方案类型*/
	private Long type ;
	/**方案分类*/
	private Long category;
	/**方案名称*/
	private String name ;
	/**方案价格*/
	private BigDecimal price ;
	/**辅材单价(xx元/平方米)*/
	private BigDecimal auxiliaryUnitPrice;
	/**人工安装费单价(xx元/平方米)*/
	private BigDecimal installCost;
	/**方案建筑面积*/
	private Integer acreage;
	/** 展示图片 */
	private String image;
	/**创建人*/
	private String createPerson;
	/** 搜索关键词 */
	private String keyword;
	/** 页面标题 */
	private String seoTitle;
	/** 是否上架 */
	private Boolean isMarketable;
	/** 是否列出 */
	private Boolean isList;
	/** 是否置顶 */
	private Boolean isTop;
	/** 是否为赠品 */
	private Boolean isGift;
	/** 是否为特惠活动 */
	private Boolean isTehui;
	/**特惠标题*/
	private String tehuiTitle;
	/**方案属性*/
	private String attribute;
	/**价格说明*/
	private String priceDescript;
	/**是否已逻辑删除*/
	private Boolean isDelete = false;
	/**适用面积开始值*/
	private Integer beginArea;
	/**适用面积结束值*/
	private Integer endArea;
	/**面积标签(标记方案面积所属面积范围，如60以下，60-120，120以上)*/
	private Integer areaTag;
	/**是否可修改*/
	private Boolean isChange=false;
	
	//////////大文本字段//////////////
	/** 方案描述 */
	private String introduction;
	/** 方案配置参数 */
	private String parameter;
	/** 设备配置表 */
	private String configuration;
	/**辅材描述*/
	private String auxiliaryDescript;
	/** 安装规范 */
	private String installStandard;
	
	/** 主材产品(可有多个) */
	private List<SchemeProduct> schemeProducts = new ArrayList<SchemeProduct>();
	/** 方案图片 */
	private List<SchemeImage> schemeImages = new ArrayList<SchemeImage>();
	/** 施工图片 */
	private List<SchemeConstructImage> constructImages = new ArrayList<SchemeConstructImage>();
	/** 标签 */
	private List<Tag> tags = new ArrayList<Tag>();
	
	/**
	 * 上架时间
	 */
	private Date upDate;
	/**
	 * 下架时间
	 */
	private Date downDate;
	/**外机数量*/
	private Integer outNumber;
	/**内机数量*/
	private Integer inNumber;
	
	@JsonProperty
	public String getSn() {
		return sn;
	}
	public void setSn(String sn) {
		this.sn = sn;
	}
	
	@JsonProperty
	public Long getType() {
		return type;
	}
	public void setType(Long type) {
		this.type = type;
	}
	
	@JsonProperty
	public Long getCategory() {
		return category;
	}
	public void setCategory(Long category) {
		this.category = category;
	}
	@JsonProperty
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@JsonProperty
	public BigDecimal getPrice() {
		return price;
	}
	public void setPrice(BigDecimal price) {
		this.price = price;
	}
	
	@JsonProperty
	public BigDecimal getAuxiliaryUnitPrice() {
		return auxiliaryUnitPrice;
	}
	public void setAuxiliaryUnitPrice(BigDecimal auxiliaryUnitPrice) {
		this.auxiliaryUnitPrice = auxiliaryUnitPrice;
	}
	
	@JsonProperty
	public BigDecimal getInstallCost() {
		return installCost;
	}
	public void setInstallCost(BigDecimal installCost) {
		this.installCost = installCost;
	}
	
	@JsonProperty
	public Integer getAcreage() {
		return acreage;
	}
	public void setAcreage(Integer acreage) {
		this.acreage = acreage;
	}
	
	@JsonProperty
	public String getImage() {
		return image;
	}
	public void setImage(String image) {
		this.image = image;
	}
	
	public String getCreatePerson() {
		return createPerson;
	}
	public void setCreatePerson(String createPerson) {
		this.createPerson = createPerson;
	}
	
	@JsonProperty
	public String getKeyword() {
		return keyword;
	}
	public void setKeyword(String keyword) {
		this.keyword = keyword;
	}
	
	@JsonProperty
	public String getSeoTitle() {
		return seoTitle;
	}
	public void setSeoTitle(String seoTitle) {
		this.seoTitle = seoTitle;
	}
	
	@JsonProperty
	public Boolean getIsMarketable() {
		return isMarketable;
	}
	public void setIsMarketable(Boolean isMarketable) {
		this.isMarketable = isMarketable;
	}
	
	@JsonProperty
	public Boolean getIsList() {
		return isList;
	}
	public void setIsList(Boolean isList) {
		this.isList = isList;
	}
	
	@JsonProperty
	public Boolean getIsTop() {
		return isTop;
	}
	public void setIsTop(Boolean isTop) {
		this.isTop = isTop;
	}
	
	@JsonProperty
	public Boolean getIsGift() {
		return isGift;
	}
	public void setIsGift(Boolean isGift) {
		this.isGift = isGift;
	}
	
	@JsonProperty
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "766_scheme_scheme_product")
	public List<SchemeProduct> getSchemeProducts() {
		return schemeProducts;
	}
	public void setSchemeProducts(List<SchemeProduct> schemeProducts) {
		this.schemeProducts = schemeProducts;
	}
	
	@JsonProperty
	@Valid
	@ElementCollection
	@CollectionTable(name = "766_scheme_image")
	public List<SchemeImage> getSchemeImages() {
		return schemeImages;
	}
	public void setSchemeImages(List<SchemeImage> schemeImages) {
		this.schemeImages = schemeImages;
	}
	
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "766_scheme_tag")
	@OrderBy("order asc")
	public List<Tag> getTags() {
		return tags;
	}
	public void setTags(List<Tag> tags) {
		this.tags = tags;
	}
	
	@JsonProperty
	public String getAttribute() {
		return attribute;
	}
	public void setAttribute(String attribute) {
		this.attribute = attribute;
	}
	
	@JsonProperty
	@Lob
	public String getIntroduction() {
		return introduction;
	}
	public void setIntroduction(String introduction) {
		this.introduction = introduction;
	}
	
	@JsonProperty
	@Lob
	public String getParameter() {
		return parameter;
	}
	public void setParameter(String parameter) {
		this.parameter = parameter;
	}
	
	@JsonProperty
	@Lob
	public String getConfiguration() {
		return configuration;
	}
	public void setConfiguration(String configuration) {
		this.configuration = configuration;
	}
	
	@JsonProperty
	@Lob
	public String getAuxiliaryDescript() {
		return auxiliaryDescript;
	}
	public void setAuxiliaryDescript(String auxiliaryDescript) {
		this.auxiliaryDescript = auxiliaryDescript;
	}
	
	@JsonProperty
	@Lob
	public String getInstallStandard() {
		return installStandard;
	}
	public void setInstallStandard(String installStandard) {
		this.installStandard = installStandard;
	}
	
	@JsonProperty
	public String getPriceDescript() {
		return priceDescript;
	}
	public void setPriceDescript(String priceDescript) {
		this.priceDescript = priceDescript;
	}
	
	@JsonProperty
	@Valid
	@ElementCollection
	@CollectionTable(name = "766_scheme_construct_image")
	public List<SchemeConstructImage> getConstructImages() {
		return constructImages;
	}
	public void setConstructImages(List<SchemeConstructImage> constructImages) {
		this.constructImages = constructImages;
	}
	public Boolean getIsDelete() {
		return isDelete;
	}
	public void setIsDelete(Boolean isDelete) {
		this.isDelete = isDelete;
	}
	public Integer getBeginArea() {
		return beginArea;
	}
	public void setBeginArea(Integer beginArea) {
		this.beginArea = beginArea;
	}
	public Integer getEndArea() {
		return endArea;
	}
	public void setEndArea(Integer endArea) {
		this.endArea = endArea;
	}
	public Integer getAreaTag() {
		return areaTag;
	}
	public void setAreaTag(Integer areaTag) {
		this.areaTag = areaTag;
	}
	public Boolean getIsTehui() {
		return isTehui;
	}
	public void setIsTehui(Boolean isTehui) {
		this.isTehui = isTehui;
	}
	public String getTehuiTitle() {
		return tehuiTitle;
	}
	public void setTehuiTitle(String tehuiTitle) {
		this.tehuiTitle = tehuiTitle;
	}
	public Boolean getIsChange() {
		return isChange;
	}
	public void setIsChange(Boolean isChange) {
		this.isChange = isChange;
	}
	public Date getUpDate() {
		return upDate;
	}
	public void setUpDate(Date upDate) {
		this.upDate = upDate;
	}
	public Date getDownDate() {
		return downDate;
	}
	public void setDownDate(Date downDate) {
		this.downDate = downDate;
	}
	public Integer getOutNumber() {
		return outNumber;
	}
	public void setOutNumber(Integer outNumber) {
		this.outNumber = outNumber;
	}
	public Integer getInNumber() {
		return inNumber;
	}
	public void setInNumber(Integer inNumber) {
		this.inNumber = inNumber;
	}
	
}
